//
//  ChartCategoryDetailItem.swift
//  KoiAccounting
//
//  Created by 纪洪文 on 08.04.25.
//

import SwiftUI

struct ChartCategoryDetailItem: View {
    
    var item: AccountingDetailCombine
    
    var body: some View {
        HStack {
            CategoryIconView(item: item.category)
            VStack {
                Text(item.getTitle()).font(.system(size: 15))
                let subTitle = item.getSubTitle()
                if (!subTitle.isEmpty) {
                    Text(item.getSubTitle()).font(.system(size:12))
                }
            }
            Spacer()
            VStack (alignment:.trailing){
                Text(item.getAmount())
                    .font(.system(size: 14))
                    .foregroundColor(Color.koiColorTitle)
                Text(item.getDateText())
                    .font(.system(size: 12))
                    .foregroundColor(Color.koiColorTitleSecond)
            }
        }
    }
}

#Preview {
    ChartCategoryDetailItem(item: AccountingDetailCombine.previewData())
}
